package cn.bqjr.eily.samples.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableLogic;
import com.baomidou.mybatisplus.enums.FieldFill;

import java.io.Serializable;
import java.util.Date;

public abstract class BasePO<T> implements Serializable {
    /**
     * 是否有效，1-true-有效，0-false-无效
     */
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Boolean valid;
    private String remark;
    @TableField(fill = FieldFill.INSERT)
    private Date createdDate;
    @TableField(fill = FieldFill.INSERT)
    private Long createdBy;
    @TableField(fill = FieldFill.UPDATE)
    private Date lastUpdatedDate;
    @TableField(fill = FieldFill.UPDATE)
    private Long lastUpdatedBy;

    public static final String REMARK = "remark";
    public static final String VALID = "valid";
    public static final String CREATEDDATE = "createdDate";
    public static final String CREATEDBY = "createdBy";
    public static final String LASTUPDATEDDATE = "lastUpdatedDate";
    public static final String LASTUPDATEDBY = "lastUpdatedBy";

    // Public Methods
    public Boolean isValid() {
        return valid;
    }

    public T setValid(Boolean valid) {
        this.valid = valid;
        return (T) this;
    }

    public String getRemark() {
        return remark;
    }

    public T setRemark(String remark) {
        this.remark = remark;
        return (T) this;
    }

    public Date getCreatedDate() {
        if (null != createdDate) {
            return (Date) createdDate.clone();
        }
        return null;
    }

    public T setCreatedDate(Date date) {
        if (date != null) {
            this.createdDate = (Date) date.clone();
        }
        return (T) this;
    }

    public Long getCreatedBy() {
        return createdBy;
    }

    public T setCreatedBy(Long createdBy) {
        this.createdBy = createdBy;
        return (T) this;
    }

    public Date getLastUpdatedDate() {
        if (null != lastUpdatedDate) {
            return (Date) lastUpdatedDate.clone();
        }
        return null;
    }

    public T setLastUpdatedDate(Date updatedDate) {
        if (updatedDate != null) {
            this.lastUpdatedDate = (Date) updatedDate.clone();
        }
        return (T) this;
    }

    public Long getLastUpdatedBy() {
        return lastUpdatedBy;
    }

    public T setLastUpdatedBy(Long lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
        return (T) this;
    }
}
